import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element'
import 'bootstrap/dist/css/bootstrap.min.css'
import $ from "jquery";


var axios = require('axios')
axios.defaults.withCredentials=true
axios.defaults.baseURL = 'http://localhost:8888/'
// 使请求带上凭证信息


router.beforeEach((to, from, next) => {
      if (to.meta.requiredAuth) {
          if (store.state.username) {
              next()
          } else {
              next({
                  path: 'login',
                  query: {redirect: to.fullPath}
              })
          }
      }
        else {
            next()
          }
      }
)

Vue.prototype.$axios = axios
Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
